package com.bawei.image

/**
 * 作者：Jason
 * 日期：2023/10/18
 * 描述：图片参数对象
 */
class ImageOptions private constructor(
    val placeImage: Int,
    val errorImage: Int,
    val isStaticImg: Boolean,
    val isGif: Boolean,
    val imgSize: IntArray,
    val skipMemoryCache: Boolean,
    val skipDiskCache: Boolean,
    val isCircle: Boolean,
    val roundRadius: Int
) {

    companion object Builder{
        private var placeImage = 0
        private var errorImage = 0
        private var isStaticImg = false
        private var isGif = true
        private var imgSize = intArrayOf()
        private var skipMemoryCache = false
        private var skipDiskCache = false
        private var isCircle = false
        private var roundRadius = 0

        fun setPlaceImage(placeImage: Int): Builder{
            this.placeImage = placeImage
            return this
        }

        fun setErrorImage(errorImage: Int): Builder{
            this.errorImage = errorImage
            return this
        }

        fun isStaticImage(isStaticImg: Boolean): Builder{
            this.isStaticImg = isStaticImg
            return this
        }

        fun isGifImage(isGif: Boolean): Builder{
            this.isGif = isGif
            return this
        }

        fun setImageSize(imgSize: IntArray): Builder{
            this.imgSize = imgSize
            return this
        }

        fun skipMemoryCache(skipMemoryCache: Boolean): Builder{
            this.skipMemoryCache = skipMemoryCache
            return this
        }

        fun skipDiskCache(skipDiskCache: Boolean): Builder{
            this.skipDiskCache = skipDiskCache
            return this
        }

        fun setCircleImage(isCircle: Boolean): Builder{
            this.isCircle = isCircle
            return this
        }

        fun setRoundRadius(radius: Int): Builder{
            this.roundRadius = radius
            return this
        }

        fun build(): ImageOptions = ImageOptions(placeImage, errorImage, isStaticImg, isGif, imgSize, skipMemoryCache, skipDiskCache, isCircle, roundRadius)
    }


}